import { createApp, watch } from 'vue'
import { createPinia } from 'pinia'
import piniaPluginPersist from 'pinia-plugin-persist'
import './style.css'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import './style/element-variables.css'
import plugin from './plugin'
// import WebTracing from '@web-tracing/vue3'
// import webTracingConfig from '../webTracing.config.js'
//手写pinia
// import { createPinia_m } from './pinia'

const app = createApp(App);

const pinia = createPinia()
pinia.use(piniaPluginPersist)
watch(pinia.state, (state) => {
  console.log(state);
  // 每当状态发生变化时，将所有 state 持久化到本地存储
  // localStorage.setItem('piniaState', JSON.stringify(state))
}, { deep: true })

// app.use(createPinia_m())
app.use(pinia)
app.use(router);
app.use(ElementPlus)
app.use(plugin)

// const sendEventType = {
//   pv: '路由',
//   error: '错误',
//   performance: '资源',
//   click: '点击',
//   dwell: '页面卸载',
//   intersection: '曝光采集'
// }

// app.use(WebTracing, webTracingConfig)

app.mount('#app')